package com.xmg.boot.demo.bootlesson1.user.listen;

import com.xmg.boot.demo.bootlesson1.user.controller.UserController;
import com.xmg.boot.demo.bootlesson1.user.entity.pojo.Student;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.CustomAutowireConfigurer;
import org.springframework.stereotype.Component;

/**
 * @Author: ma
 * @CreateTime: 2023-11-23
 * @Description: 消息队列接收
 * @Version: 1.0
 */

@Component
@RabbitListener(queues = "hello")
public class RabbitReceiver {
    private final Logger logger= LoggerFactory.getLogger(RabbitReceiver.class);

    @RabbitHandler
    public void process(String mes){
        logger.info("String消息队列接收：{}",mes);
        System.out.println(mes);
    }

    @RabbitHandler
    public void process(Student student){
        logger.info("Object消息队列接收：{}",student);
        System.out.println(student);
    }
}
